/*    */ package system.staros.cblock2;
/*    */ 
/*    */ import java.io.IOException;
/*    */ import java.io.InputStream;
/*    */ import java.io.PrintStream;
/*    */ import system.staros.cblock1.Message;
/*    */ import system.staros.cblock1.Task;
/*    */ 
/*    */ public class Keyboard extends Task
/*    */ {
/*    */   public void handleMessage()
/*    */   {
/*    */   }
/*    */ 
/*    */   public void run()
/*    */   {
/* 22 */     int i = 1;
/* 23 */     byte[] arrayOfByte = new byte[128];
/*    */ 
/* 26 */     print("Starting Keyboard. \tPID=");
/* 27 */     println(Integer.toString(getPID()));
/*    */ 
/* 29 */     while (i != 0)
/*    */     {
/* 31 */       Message localMessage1 = getMessage(getPID());
/* 32 */       if (localMessage1 != null) {
/* 33 */         localMessage1.locked = true;
/* 34 */         switch (localMessage1.ID) {
/*    */         case 101:
/*    */           int j;
/*    */           try {
/* 38 */             j = System.in.read(arrayOfByte);
/*    */           } catch (IOException localIOException) {
/* 40 */             j = 0;
/*    */           }
/* 42 */           if (j > 0) {
/* 43 */             Message localMessage2 = new Message();
/*    */ 
/* 45 */             localMessage2.PID_from = getPID();
/* 46 */             localMessage2.PID_to = localMessage1.PID_from;
/* 47 */             localMessage2.ID = 100;
/* 48 */             localMessage2.data = new byte[j];
/* 49 */             for (int k = 0; k < j; k++)
/* 50 */               localMessage2.data[k] = arrayOfByte[k];
/* 51 */             localMessage2.data_size = j;
/* 52 */             putMessage(localMessage2);
/* 53 */           }break;
/*    */         case 1:
/* 56 */           i = 0;
/* 57 */           break;
/*    */         }
/*    */ 
/* 61 */         localMessage1.handled = true;
/*    */       }
/*    */       try {
/* 64 */         sleep(1000L);
/*    */       } catch (InterruptedException localInterruptedException) {
/*    */       }
/*    */     }
/* 68 */     System.out.println("Keyboard stopped.");
/*    */   }
/*    */ }

/* Location:           D:\Марк\!IMPORTANT\staros\archive\version-2.260.zip
 * Qualified Name:     system.staros.cblock2.Keyboard
 * JD-Core Version:    0.6.1
 */